package vacuum.lgadmin;

import java.io.File;

import org.bukkit.command.CommandExecutor;
import org.bukkit.configuration.file.YamlConfiguration;

/**
 * Wrapper class for LGPlugins
 * @author Ryan Amos
 */
public abstract class LGPlugin 
{
	
	protected LGAdmin lga;
	
	public LGPlugin(LGAdmin lga){
		this.lga = lga;
	}

	public abstract void onEnable();
	public abstract void onDisable();
	public abstract String getName();
	public abstract String getVersion();
	
	
	public void registerCommand(CommandData data, CommandExecutor exec){
		lga.registerCommand(data, exec);
	}
	
	public void removeCommand(CommandData data){
		lga.removeCommand(data);
	}

	public String getFullName(){
		return getName() + "v" + getVersion();
	}

	public void log(Object obj){
		System.out.println("[" + getName() + "] " + String.valueOf(obj));
	}
	
	public File getDataFolder(){
		return new File(lga.getDataFolder(), getName());
	}
	
	public YamlConfiguration getConfig(){
		System.out.println(getDataFolder() + File.separator + "config.yml");
		return YamlConfiguration.loadConfiguration(new File(getDataFolder() + File.separator + "config.yml"));
	}

}
